diff --git a/src/lib/php/Application/RepositoryApi.php b/src/lib/php/Application/RepositoryApi.php
new file mode 100644
index 00000000..7f84a1e4
--- /dev/null
+++ b/src/lib/php/Application/RepositoryApi.php
@@ -0,0 +1,65 @@
+ $url,
+ CURLOPT_HEADER => true,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_HTTPHEADER => array('User-Agent: fossology')
+ );
+ curl_setopt_array($handle, $curlopt);
+
+ $response = curl_exec($handle);
+ if ($response !== false) {
+ $headerSize = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
+ $resultBody = json_decode(substr($response, $headerSize), true);
+ } else {
+ $resultBody = array();
+ }
+ curl_close($handle);
+ return $resultBody;
+ }
+
+ /**
+ * @return array
+ */
+ public function getLatestRelease()
+ {
+ return $this->curlGet('releases/latest');
+ }
+
+ /**
+ * @param int $days
+ * @return array
+ */
+ public function getCommitsOfLastDays($days = 30)
+ {
+ $since = '?since=' . date('Y-m-d\\TH:i:s\\Z', time() - 3600 * 24 * $days);
+ return $this->curlGet('commits' . $since);
+ }
+
+}
diff --git a/src/lib/php/Application/test/RepositoryApiTest.php b/src/lib/php/Application/test/RepositoryApiTest.php
new file mode 100644
index 00000000..8e7d94b0
--- /dev/null
+++ b/src/lib/php/Application/test/RepositoryApiTest.php
@@ -0,0 +1,37 @@
+repositoryApi = new RepositoryApi();
+ }
+
+ public function testCurlGet() {
+ $result = $this->repositoryApi->getLatestRelease();
+ assertThat($result, hasKey('tag_name'));
+ }
+
+ public function testGetCommitsOfLastDays() {
+ $result = $this->repositoryApi->getCommitsOfLastDays(60);
+ assertThat($result, is(not(emptyArray())));
+ assertThat($result[0], hasKey('sha'));
+ }
+}
diff --git a/src/www/ui/page/AboutPage.php b/src/www/ui/page/AboutPage.php
index 510946c4..5973f5d0 100644
--- a/src/www/ui/page/AboutPage.php
+++ b/src/www/ui/page/AboutPage.php
@@ -1,64 +1,77 @@
"About Fossology",
self::MENU_LIST => "Help::About",
self::REQUIRES_LOGIN => false,
));
$this->licenseDao = $this->getObject('dao.license');
}
/**
* @param Request $request
* @return Response
*/
protected function handle(Request $request)
- {
+ {
$vars = array(
'licenseCount' => $this->licenseDao->getLicenseCount(),
'project' => _("FOSSology"),
- 'copyright' => _("Copyright (C) 2007-2014 Hewlett-Packard Development Company, L.P.
\nCopyright (C) 2014-2015 Siemens AG."),
+ 'copyright' => _("Copyright (C) 2007-2014 Hewlett-Packard Development Company, L.P.
\nCopyright (C) 2014-2016 Siemens AG."),
);
+
+ if (Auth::isAdmin()) {
+ $repositoryApi = new RepositoryApi();
+ $latestRelease = $repositoryApi->getLatestRelease();
+ $commits = $repositoryApi->getCommitsOfLastDays(30);
+ $commit = empty($commits) ? '' : substr($commits[0]['sha'],0,6);
+
+ $vars = array_merge($vars, array(
+ 'latestVersion' => $latestRelease,
+ 'lastestCommit' => $commit));
+ }
return $this->render('about.html.twig', $this->mergeWithDefault($vars));
}
}
register_plugin(new AboutPage());
diff --git a/src/www/ui/template/about.html.twig b/src/www/ui/template/about.html.twig
index d1e45ac6..b7189b00 100644
--- a/src/www/ui/template/about.html.twig
+++ b/src/www/ui/template/about.html.twig
@@ -1,26 +1,41 @@
-{# Copyright 2014-2015 Siemens AG
+{# Copyright 2014-2016 Siemens AG
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
This file is offered as-is, without any warranty.
#}
{% extends "include/base.html.twig" %}
{% block content %}
-
{{ "FOSSology version" | trans }} {{ versionInfo.version }} ({{ 'code revision' | trans }} {{ versionInfo.commitHash }}) {{ "with" | trans }} {{ licenseCount }} {{ "known licenses in database" |trans }}
{{ copyright }}
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ {{ 'The'|trans }} + {{ 'latest version'|trans }} {{ latestVersion.tag_name }} + {{ 'was created at'|trans }} {{ latestVersion.created_at }} + {{ 'and is ready for'|trans }} {{ 'download'|trans }}. +
+ {% endif %} + {% if latestCommit %} ++ {{ 'The latest Github commit'|trans }} {{ lastestCommit }} + {% if lastestCommit!=versionInfo.commitHash %}{{ 'is not installed'|trans }}{% + else %}{{ 'is not installed'|trans }}{%endif%}. +
+ {% endif %} {% endblock %} diff --git a/utils/fo-installdeps b/utils/fo-installdeps index 89707ee9..2b024a75 100755 --- a/utils/fo-installdeps +++ b/utils/fo-installdeps @@ -1,306 +1,306 @@ # FOSSology fo-installdeps script # Copyright (C) 2008-2014 Hewlett-Packard Development Company, L.P. # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # version 2 as published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # This script helps you install build and runtime dependencies on a system. # It is NOT indented to replace package dependencies, it's just a tool to # make testing the "upstream" build and install process. If you determine # this script isn't installing something you think it should, consult # the packaging metadata for the system in question as that is the # canonical location for such info, then fix it there first and also # update this file and the INSTALL document. ## Options parsing and setup # parse options OPTS=`getopt -o rbeohy --long runtime,buildtime,everything,offline,help -n 'fo-installdeps' -- "$@"` if [ $? != 0 ]; then echo "ERROR: Bad option specified." OPTS="--help" fi eval set -- "$OPTS" # if no options then do everything if [ "$OPTS" = " --" ]; then EVERYTHING=1 fi # # Don't show the -y option. Should only be used for install testing, as using # it without being careful can destroy your system. # YesOpt= #Default should be installation with internet connection OFFLINE=0 while true; do case "$1" in -r|--runtime) RUNTIME=1; shift;; -b|--buildtime) BUILDTIME=1; shift;; -e|--everything) EVERYTHING=1; shift;; -o|--offline) OFFLINE=1; shift;; -y) YesOpt=" -y "; shift;; -h|--help) echo "Usage: fo-installdeps [options]"; echo " -r or --runtime : install runtime dependencies" echo " -b or --buildtime : install buildtime dependencies" echo " -e or --everything : install all dependencies (default)" echo " -o or --offline : do not run composer installation" echo " -y : Automatic yes to prompts" echo " -h or --help : this help text" exit;; --) shift; break;; *) echo "ERROR: option $1 not recognised"; exit 1;; esac done # This must run as root. if [ `id -u` != "0" ] ; then echo "ERROR: fo-installdeps must run as root." echo "Aborting." exit 1 fi if [ $EVERYTHING ]; then echo "*** Installing both runtime and buildtime dependencies ***" RUNTIME=1 BUILDTIME=1 fi # figure out what distro we're on DISTRO=`lsb_release -is` CODENAME=`lsb_release -cs` if [ "$?" != "0" ]; then echo "ERROR: this program requires the lsb_release command. On Debian based" echo " systems this is probably in the lsb-release package, on" echo " Fedora/RedHat systems it is probably the redhat-lsb package." exit 1 fi ######################################################################## echo "install core dependencies" if [ $BUILDTIME ]; then echo "*** Installing $DISTRO buildtime dependencies ***"; case "$DISTRO" in Debian|Ubuntu|LinuxMint) echo "DB: Installing build essential....." apt-get $YesOpt install \ libmxml-dev curl libxml2-dev libcunit1-dev \ build-essential libtext-template-perl subversion rpm librpm-dev libmagic-dev libglib2.0 libboost-regex-dev libboost-program-options-dev POSTGRE=`dpkg --get-selections|grep postgresql-server-dev` if [ -z "$POSTGRE" ]; then ## if postgresql-server-dev is installed case "$CODENAME" in lenny|hardy) apt-get $YesOpt install $YesOpt postgresql-server-dev-8.3;; squeeze) apt-get $YesOpt install $YesOpt postgresql-server-dev-8.4;; wheezy) apt-get $YesOpt install $YesOpt postgresql-server-dev-9.1;; sid) apt-get $YesOpt install $YesOpt postgresql-server-dev-8.4;; lucid|natty) apt-get $YesOpt install postgresql-server-dev-8.4;; isadora) apt-get $YesOpt install postgresql-server-dev-8.4;; precise|oneiric|quantal|raring|saucy) apt-get $YesOpt install postgresql-server-dev-9.1;; trusty|jessie) apt-get $YesOpt install postgresql-server-dev-9.3;; *) echo "ERROR: Unknown or Unsupported $DISTRO release, please report to the mailing list"; exit 1;; esac fi ;; Fedora) # F8=Werwolf F9=Sulphur F10=Cambridge F11=Leonidas F12=Constantine dev=Rawhide if [ $YesOpt ]; then YesOpt='-y' fi yum $YesOpt groupinstall "Development Tools" yum $YesOpt install \ perl-Text-Template subversion \ postgresql-devel file-devel \ libxml2 \ boost-devel ;; Mandriva) # 2008.1 tested urpmi \ postgresql-devel \ libxml2 \ perl-Text-Template subversion gcc make perl ;; RedHatEnterprise*|CentOS) # 4=Nahant* 5=Tikanga* if [ $YesOpt ]; then YesOpt='-y' fi yum $YesOpt install \ postgresql-devel \ gcc make file libxml2 \ perl-Text-Template subversion \ boost-devel ;; *) echo "ERROR: distro not recognised, please fix and send a patch"; exit 1;; esac fi ######################################################################## if [ $RUNTIME ]; then echo "*** Installing $DISTRO runtime dependencies ***"; echo "*** For optional email notifications a Mail Transport Agent Must be ***"; echo "*** installed. Consult with your system administrator. Or try ***"; echo "*** apt-get install mail-transport-agent, pick one and install it***"; case "$DISTRO" in Debian|Ubuntu|LinuxMint) echo "doing runtime" apt-get $YesOpt install apache2 libapache2-mod-php5 apt-get $YesOpt install php5 php5-pgsql php-pear php5-cli \ libxml2 \ - binutils php-gettext \ + binutils php-gettext php5-curl \ cabextract cpio sleuthkit genisoimage \ poppler-utils upx-ucl \ unrar-free unzip p7zip-full p7zip wget \ subversion git \ dpkg-dev POSTGRE=`dpkg --get-selections|grep postgresql-8.4` if [ -z "$POSTGRE" ]; then ## if postgresql-server-dev is installed case "$CODENAME" in squeeze) apt-get $YesOpt install postgresql-8.4;; wheezy) apt-get $YesOpt install postgresql-9.1;; sid) apt-get $YesOpt install postgresql-8.4;; lucid|natty) apt-get $YesOpt install postgresql-8.4;; isadora) apt-get $YesOpt install postgresql-8.4;; precise|oneiric|quantal|raring|saucy) apt-get $YesOpt install postgresql-9.1;; trusty|jessie) apt-get $YesOpt install postgresql-9.3;; *) echo "ERROR: Unknown or Unsupported $DISTRO release, please report to the mailing list"; exit 1;; esac fi ;; Mandriva) [ $AGENT ] || urpmi postgresql-server httpd urpmi php php-pear php-pgsql postgresql \ libxml2 \ cabextract genisoimage upx sleuthkit binutils bzip2 cpio \ mkisofs p7zip poppler-utils rpm tar unzip gzip echo "NOTE: unrar is available in PLF, please install it via urpmi if" echo " the repository is configured or from http://plf.zarb.org/packages.php" ;; Fedora) if [ $YesOpt ]; then YesOpt='-y' fi yum $YesOpt install postgresql-server httpd yum $YesOpt install \ postgresql \ php php-pear php-pgsql php-process php-xml php-mbstring\ smtpdaemon \ libxml2 \ binutils # enable, possible init, and start postgresql /sbin/chkconfig postgresql on if [ ! -f /var/lib/pgsql/data/PG_VERSION ]; then /sbin/service postgresql initdb fi /sbin/service postgresql start # F8=Werwolf F9=Sulphur F10=Cambridge F11=Leonidas F12=Constantine dev=Rawhide case "$CODENAME" in Werwolf|Sulphur) echo "NOTE: sleuthkit and unrar is not available in Fedora release $CODENAME,"; echo " please install from upstream sources.";; Cambridge|Rawhide|Leonidas|Constantine) yum $YesOpt install sleuthkit echo "NOTE: unrar is not available in Fedora release $CODENAME," echo " please install from upstream sources." ;; *) echo "ERROR: Unknown Fedora release, please report a bug. Attempting to install anyway"; yum install sleuthkit echo "NOTE: unrar is not available in Fedora release $CODENAME," echo " please install from upstream sources." ;; esac ;; RedHatEnterprise*|CentOS) # 4=Nahant* 5=Tikanga* if [ $YesOpt ]; then YesOpt='-y' - fi + fi yum $YesOpt install postgresql-server httpd yum $YesOpt install \ postgresql \ php php-pear php-pgsql php-process\ smtpdaemon \ file libxml2 \ - binutils + binutils echo "NOTE: cabextract, sleuthkit, upx, and unrar are not" echo " available in RHEL please install from upstream sources.";; *) echo "ERROR: distro not recognised, please fix and send a patch"; exit 1;; esac - + which composer if [ $? -eq 0 ]; then if [ $OFFLINE -eq 0 ]; then composer selfupdate else echo "WARNING: composer is not updated due to the offline switch" fi else if [ $OFFLINE -eq 0 ]; then curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer else echo "WARNING: composer is not installed, and the installer does not install it due to the offline switch" echo "Please run the equivalent of 'curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer'" fi fi fi ######################################################################## # install dependencies of modules via running $mods_enabled_dir/$mod_name/mod_deps install_mod_deps() { mods_dir=$1 for mod_deps in `find -L $mods_dir -name mod_deps`; do if [ -f $mod_deps ]; then echo "run $mod_deps to install dependencies" /bin/sh $mod_deps $options fi done } options="" if [ $BUILDTIME ]; then options='-b ' fi if [ $RUNTIME ]; then options="$options -r" fi if [ ! -z "$YesOpt" ]; then options="$options -y" fi -BASEDIR=$(dirname $0) +BASEDIR=$(dirname $0) mods_dir=$BASEDIR"/../src/" ## get the directory where fo-installdeps resides -install_mod_deps $mods_dir - +install_mod_deps $mods_dir + ########################################################################